package June;
import java.util.Scanner;
public class Test_1_5 {
    public static void main(String[] args) {
        //出票系统:根据淡旺季的月份和年龄，打印票价
        //4 10 旺季:成人(18-60):60  儿童(<18):半价  老人(>60):1/3
        //淡季:
        //成人:40其他:20

        //思路：
        //用int接受月份，且月份为1~12
        //用if-else单分支判断是旺季还是淡季
        //用if-else多分支判断年龄来决定票价
        //完成代码
        Scanner myscanner = new Scanner(System.in);
        System.out.print("请输入月份:");
        int year = myscanner.nextInt();
        if (year >= 1 && year <= 12) {
            if (year >= 4 && year <= 10) {
                System.out.print("请输入年龄:");
                int age = myscanner.nextInt();
                if (age >= 18 && age <= 60) {
                    System.out.print("票价为60元");
                } else if (age < 18) {
                    System.out.print("票价为30元");
                } else {
                    System.out.print("票价为20元");
                }
            } else {
                System.out.print("请输入年龄:");
                int age = myscanner.nextInt();
                if (age >= 18 && age <= 60) {
                    System.out.print("票价为40元");
                } else {
                    System.out.print("票价为20元");
                }
            }
        } else {
            System.out.print("月份输入有误，请输入1~12：");
        }
    }
}
